#include <cusp/ell_matrix.h>
#include <cusp/gallery/poisson.h>

#include <cusp/multiply.h>
#include <cusp/detail/device/generalized_spmv/coo_flat.h>
#include <cusp/detail/device/generalized_spmv/csr.h>
#include <cusp/detail/device/generalized_spmv/dia.h>
#include <cusp/detail/device/generalized_spmv/ell.h>
#include <cusp/detail/device/generalized_spmv/hyb.h>

// where to perform the computation
typedef cusp::device_memory MemorySpace;

// which floating point type to use
typedef float ValueType;

int main(void)
{
    // create an empty sparse matrix structure (HYB format)
    cusp::ell_matrix<int, ValueType, MemorySpace> A;

    // create a 2d Poisson problem on a 10x10 mesh
    cusp::gallery::poisson5pt(A, 10, 10);

    // allocate storage for solution (x) and right hand side (b)
    cusp::array1d<ValueType, MemorySpace> x(A.num_rows, 0);
    cusp::array1d<ValueType, MemorySpace> b(A.num_rows, 1);

    // solve the linear system A * x = b with the Conjugate Gradient method
    cusp::detail::device::spmv(A, 
				thrust::raw_pointer_cast(&x[0]), 
				thrust::raw_pointer_cast(&b[0]), 
				ValueType(2.0), ValueType(3.0));

    return 0;
}

